﻿<h2 style="margin-bottom:5px;"><a href="admin_tech.php?method=addtech" class="button">添加教程</a></h2>
<form action="admin_tech.php" method="post">
<table width="100%" class="search">
<tr>
	<td class="title">教程ID：</td>
	<td><input type="text" name="s_id" style="width:70px;" value="{{$smarty.post.s_id}}"></td>
	<td class="title">教程标题：</td>
	<td><input type="text" name="s_title" style="width:70px;" value="{{$smarty.post.s_title}}"></td>
	<td class="title">分类：</td>
	<td>
		<select name="s_cid">
			<option value="">--选择分类--</option>
			{{html_options options=$cateArr selected=$smarty.post.s_cid}}
		</select>
	</td>
	<td class="title">状态：</td>
	<td>
		<select name="s_published">
			<option value="2" {{if $smarty.post.s_published == '2'}}selected{{/if}}>全部</option>
			<option value="0" {{if $smarty.post.s_published == '0'}}selected{{/if}}>未发布</option>
			<option value="1" {{if $smarty.post.s_published == '1'}}selected{{/if}}>已发布</option>
		</select>
	</td>
</tr>
<tr>
	<td class="title">创建时间：</td>
	<td colspan="3"><input type="text" name="s_time_1" style="width:80px;" onClick="WdatePicker()" value="{{$smarty.post.s_time_1}}">-<input type="text" name="s_time_2" style="width:80px;" onClick="WdatePicker()" value="{{$smarty.post.s_time_2}}"></td>
	<td colspan="4" align="center"><input type="submit" class="button" value="搜索"></td>
</tr>
</table>
</form>
<table width="100%" border="0" cellpadding="0" cellspacing="2" class="list">
	<tr>
		<th width="10%">教程ID</th>
		<th width="40%">教程标题</th>
		<th width="20%">分类</th>
		<th width="10%">发布</th>
		<th width="20%"></th>
	</tr>
	{{foreach from=$rows key=key item=item name="for"}}
	<tr id="tr_{{$item.id}}" {{if $smarty.foreach.for.index%2 eq '0'}}class="even"{{else}}class="odd"{{/if}}>
		<td align="center"><a href="{{$host_root}}/tech/{{$item.id}}.html" target="_blank">{{$item.id}}</a></td>
		<td align="center">{{$item.title}}</td>
		<td align="center">{{$item.cateName}}</td>
		<td align="center">{{$item.published}}</td>
		<td align="center"><input class="editbtn" type="button" value="编辑" onclick="javascript:location.href='?method=addtech&id={{$item.id}}'">&nbsp;<input class="delbtn" type="button" value="删除" onclick="deltech('{{$item.id}}');"></td>
	</tr>
	{{/foreach}}
</table>
<div class="fenye">{{$pageList}}</div>
<script>
	function deltech(id){
		var method = 'deltech';
		if(!confirm("确认删除？"))return false;
		$.ajax({
			type:"POST",
			url:"admin_tech.php",
			data:{method:method,id:id},
			success:function(id){
				if(id != ""){
					$("#tr_"+id).hide();
				}
			}            
		});
	}
</script>